home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / docs.lha / hem / user / user.mss < prev    next >
Text File  |  1992-02-23  |  84KB  |  2,004 lines

  1. @make[Manual] @comment{-*- Dictionary: /afs/cs/project/clisp/scribe/hem/hem; Mode: spell; Package: Hemlock -*-}
  2. @Device[postscript]
  3. @Style(Spacing = 1.2 lines)
  4. @Style(StringMax = 5000)
  5. @Use(Database "/afs/cs/project/clisp/docs/database/")
  6. @Style(FontFamily=TimesRoman)
  7. @Style(Date="March 1952")
  8. @style(DOUBLESIDED)
  9. @Libraryfile[ArpaCredit]
  10. @libraryfile[hem]
  11. @Libraryfile[Spice]
  12. @Libraryfile[Uttir]
  13.  
  14. @String(REPORTTITLE "Hemlock User's Manual")
  15.  
  16. @comment<@begin[TitlePage]
  17. @begin[TitleBox]
  18. >
  19. @blankspace(1.3inches)
  20. @heading[Hemlock User's Manual]
  21.  
  22. @center[@b<Bill Chiles>
  23. @b<Robert A. MacLachlan>
  24.  
  25.  
  26. @b<@value[date]>
  27.  
  28. @b<CMU-CS-89-133-R1>
  29. ]
  30. @comment<@end[TitleBox]>
  31. @blankspace(2lines)
  32. @begin[Center]
  33. School of Computer Science
  34. Carnegie Mellon University
  35. Pittsburgh, PA 15213
  36. @end[Center]
  37. @blankspace[2lines]
  38.  
  39. @begin[Center]
  40. This is a revised version of Technical Report CMU-CS-87-158.
  41. @end[Center]
  42.  
  43. @heading<Abstract>
  44. @begin(Text, indent 0)
  45. This document describes the @Hemlock text editor, version M3.2.  @Hemlock is a
  46. customizable, extensible text editor whose initial command set closely
  47. resembles that of ITS/TOPS-20 @Emacs.  @Hemlock is written in CMU Common Lisp
  48. and has been ported to other implementations.
  49. @end(Text)
  50.  
  51. @begin[ResearchCredit]
  52. @ArpaCredit[Contract=Basic87-90]
  53. @end[ResearchCredit]
  54. @comment<@end[TitlePage]>
  55.  
  56.  
  57. @commandstring(mh = "@f1(MH)")
  58. @commandstring(dash = "@Y[M]")
  59.  
  60. @comment[This tabclear is necessary since the definition macros don't
  61.      take care of the own tabbing needs]
  62. @tabclear
  63.  
  64.  
  65. @comment[@chap (Introduction)]
  66. @include(intro)
  67.  
  68.  
  69. @comment[@chap (Basic Commands)]
  70. @include(commands)
  71.  
  72.  
  73.  
  74. @chap[Files, Buffers, and Windows]
  75.  
  76. @section[Introduction]
  77.  
  78. @index[files]
  79. @index[buffers]
  80. @index[windows]
  81. @hemlock provides three different abstractions which are used in combination to
  82. solve the text-editing problem, while other editors tend to mash these ideas
  83. together into two or even one.
  84. @begin[description]
  85. File@\A file provides permanent storage of text.  @hemlock has commands
  86. to read files into buffers and write buffers out into files.
  87.  
  88. Buffer@\A buffer provides temporary storage of text and a capability to
  89. edit it.  A buffer may or may not have a file associated with it; if it
  90. does, the text in the buffer need bear no particular relation to the text
  91. in the file.  In addition, text in a buffer may be displayed in any number
  92. of windows, or may not be displayed at all.
  93.  
  94. Window@\A window displays some portion of a buffer on the screen.  There
  95. may be any number of windows on the screen, each of which may display any
  96. position in any buffer.  It is thus possible, and often useful, to have
  97. several windows displaying different places in the same buffer.
  98. @end[description]
  99.  
  100.  
  101. @section[Buffers]
  102. In addition to some text, a buffer has several other user-visible attributes:
  103. @begin[description]
  104. A name@\
  105. A buffer is identified by its name, which allows it to be selected, destroyed,
  106. or otherwise manipulated.
  107.  
  108. A collection of modes@\
  109. The modes present in a buffer alter the set of commands available and
  110. otherwise alter the behavior of the editor.  For details see page
  111. @pageref[modes].
  112.  
  113. A modification flag @\
  114. This flag is set whenever the text in a buffer is modified.  It is often
  115. useful to know whether a buffer has been changed, since if it has it should
  116. probably be saved in its associated file eventually.
  117.  
  118. A write-protect flag @\
  119. If this flag is true, then any attempt to modify the buffer will result in an
  120. error.
  121. @end[description]
  122.  
  123. @defcom[com "Select Buffer", bind (C-x b)]
  124. This command prompts for the name of a existing buffer and makes that buffer
  125. the @i[current buffer].  The newly selected buffer is displayed in the
  126. current window, and editing commands now edit the text in that buffer.
  127. Each buffer has its own point, thus the point will be in the place it was
  128. the last time the buffer was selected.  When prompting for the buffer, the
  129. default is the buffer that was selected before the current one.
  130. @enddefcom
  131.  
  132. @defcom[com "Select Previous Buffer", bind (C-M-l)]
  133. @defcom1[com "Circulate Buffers", bind (C-M-L)]
  134. With no prefix argument, @hid[Select Previous Buffer] selects the buffer that
  135. has been selected most recently, similar to @binding[C-x b Return].  If given a
  136. prefix argument, then it does the same thing as @hid[Circulate Buffers].
  137.  
  138. @hid[Circulate Buffers] moves back into successively earlier buffers in the
  139. buffer history.  If the previous command was not @hid[Circulate Buffers] or
  140. @hid[Select Previous Buffer], then it does the same thing as
  141. @hid[Select Previous Buffer], otherwise it moves to the next most recent
  142. buffer.  The original buffer at the start of the excursion is made the previous
  143. buffer, so @hid[Select Previous Buffer] will always take you back to where you
  144. started.
  145.  
  146. These commands are generally used together.  Often @hid[Select Previous Buffer]
  147. will take you where you want to go.  If you don't end up there, then using
  148. @hid[Circulate Buffers] will do the trick.
  149. @enddefcom
  150.  
  151. @defcom[com "Create Buffer", bind (C-x M-b)]
  152. This command is very similar to @hid[Select Buffer], but the buffer need not
  153. already exist.  If the buffer does not exist, a new empty buffer is created
  154. with the specified name.
  155. @enddefcom
  156.  
  157. @defcom[com "Kill Buffer", bind (C-x k)]
  158. This command is used to make a buffer go away.  There is no way to restore
  159. a buffer that has been accidentally deleted, so the user is given a chance
  160. to save the hapless buffer if it has been modified.  This command is poorly
  161. named, since it has nothing to do with killing text.
  162. @enddefcom
  163.  
  164. @defcom[com "List Buffers", bind (C-x C-b)]
  165. This command displays a list of all existing buffers in a pop-up window.  A
  166. "@f[*]" is displayed before the name of each modified buffer.  A buffer with no
  167. associated file is represented by the buffer name followed by the number of
  168. lines in the buffer.  A buffer with an associated file are is represented by
  169. the name and type of the file, a space, and the device and directory.  If the
  170. buffer name doesn't match the associated file, then the buffer name is also
  171. displayed.  When given a prefix argument, this command lists only the modified
  172. buffers.
  173. @enddefcom
  174.  
  175. @defcom[com "Buffer Not Modified", bind (M-~)]
  176. This command resets the current buffer's modification flag @dash @i[it does not
  177. save any changes].  This is primarily useful in cases where a user accidentally
  178. modifies a buffer and then undoes the change.  Resetting the modified flag
  179. indicates that the buffer has no changes that need to be written out.
  180. @enddefcom
  181.  
  182. @defcom[com "Check Buffer Modified", bind (C-x ~)]
  183. This command displays a message indicating whether the current buffer is modified.
  184. @enddefcom
  185.  
  186. @defcom[com "Set Buffer Read-Only"]
  187. This command changes the flag that allows the current buffer to be modified.
  188. If a buffer is read-only, any attempt to modify it will result in an error.  The
  189. buffer may be made writable again by repeating this command.
  190. @enddefcom
  191.  
  192. @defcom[com "Set Buffer Writable"]
  193. This command ensures the current buffer is modifiable.
  194. @enddefcom
  195.  
  196. @defcom[com "Insert Buffer"]
  197. This command prompts for the name of a buffer and inserts its contents at the
  198. point, pushing a buffer mark before inserting.  The buffer inserted is
  199. unaffected.
  200. @enddefcom  
  201.  
  202. @defcom[com "Rename Buffer"]
  203. This command prompts for a new name for the current buffer, which defaults
  204. to a name derived from the associated filename.
  205. @enddefcom
  206.  
  207.  
  208. @section[Files]
  209. @index[files]
  210. These commands either read a file into the current buffer or write it out to
  211. some file.  Various other bookkeeping operations are performed as well.
  212.  
  213. @defcom[com "Find File", bind (C-x C-f)]
  214. This is the command normally used to get a file into @hemlock.  It prompts
  215. for the name of a file, and if that file has already been read in, selects
  216. that buffer; otherwise, it reads file into a new buffer whose name is
  217. derived from the name of the file.  If the file does not exist, then the
  218. buffer is left empty, and @w<"@f[(New File)]"> is displayed in the echo area;
  219. the file may then be created by saving the buffer.
  220.  
  221. The buffer name created is in the form @w<"@i[name] @i[type] @i[directory]">.
  222. This means that the filename "@f[/sys/emacs/teco.mid]" has
  223. @w<"@f[Teco Mid /Sys/Emacs/]"> as its the corresponding buffer name.  The
  224. reason for rearranging the fields in this fashion is that it facilitates
  225. recognition since the components most likely to differ are placed first.  If
  226. the buffer cannot be created because it already exists, but has another file in
  227. it (an unlikely occurrence), then the user is prompted for the buffer to use,
  228. as by @hid[Create Buffer].
  229.  
  230. @hid[Find File] takes special action if the file has been modified on disk
  231. since it was read into @hemlock.  This usually happens when several people are
  232. simultaneously editing a file, an unhealthy circumstance.  If the buffer is
  233. unmodified, @hid[Find File] just asks for confirmation before reading in the
  234. new version.  If the buffer is modified, then @hid[Find File] beeps and prompts
  235. for a single key-event to indicate what action to take.  It recognizes
  236. the following key-events:
  237. @begin[description]
  238. @binding[Return, Space, y]@\
  239.  Prompt for a file in which to save the current buffer and then read in the
  240. file found to be modified on disk.
  241.  
  242. @binding[Delete, Backspace, n]@\
  243.  Forego reading the file.
  244.  
  245. @binding[r]@\
  246.  Read the file found to be modified on disk into the buffer containing the
  247. earlier version with modifications.  This loses all changes you had in the
  248. buffer.
  249. @end[description]
  250. @enddefcom
  251.  
  252. @defcom[com "Save File", bind (C-x C-s)]
  253. This command writes the current buffer out to its associated file and
  254. resets the buffer modification flag.  If there is no associated file, then
  255. the user is prompted for a file, which is made the associated file.  If
  256. the buffer is not modified, then the user is asked whether to actually
  257. write it or not.
  258.  
  259. If the file has been modified on disk since the last time it was read,
  260. @hid[Save File] prompts for confirmation before overwriting the file.
  261. @enddefcom
  262.  
  263. @defcom[com "Save All Files", bind (C-x C-m)]
  264. @defcom1[com "Save All Files and Exit", bind (C-x M-z)]
  265. @defhvar1[var "Save All Files Confirm", val {t}]
  266. @hid[Save All Files] does a @hid[Save File] on all buffers which have an
  267. associated file.  @hid[Save All Files and Exit] does the same thing and then
  268. exits @hemlock.
  269.  
  270. When @hid[Save All Files Confirm] is true, these commands will ask for
  271. confirmation before saving a file.
  272. @enddefcom
  273.  
  274. @defcom[com "Visit File", bind (C-x C-v)]
  275. This command prompts for a file and reads it into the current buffer,
  276. setting the associated filename.  Since the old contents of the buffer are
  277. destroyed, the user is given a chance to save the buffer if it is modified.
  278. As for @hid[Find File], the file need not actually exist.  This command warns
  279. if some other buffer also contains the file.
  280. @enddefcom
  281.  
  282. @defcom[com "Write File", bind (C-x C-w)] This command prompts for a file
  283. and writes the current buffer out to it, changing the associated filename
  284. and resetting the modification flag.  When the buffer's associated file is
  285. specified this command does the same thing as @hid[Save File].  @enddefcom
  286.  
  287. @defcom[com "Backup File"]
  288. This command is similar to @hid[Write File], but it neither sets the
  289. associated filename nor clears the modification flag.  This is useful for
  290. saving the current state somewhere else, perhaps on a reliable machine.
  291.  
  292. Since @hid[Backup File] doesn't update the write date for the buffer,
  293. @hid[Find File] and @hid[Save File] will get all upset if you back up
  294. a buffer on any file that has been read into @hemlock.
  295. @enddefcom
  296.  
  297. @defcom[com "Revert File"]
  298. @defhvar1[var "Revert File Confirm", val {t}]
  299. This command replaces the text in the current buffer with the contents of the
  300. associated file or the checkpoint file for that file, whichever is more recent.
  301. The point is put in approximately the same place that it was before the file
  302. was read.  If the original file is reverted to, then clear the modified flag,
  303. otherwise leave it set.  If a prefix argument is specified, then always revert
  304. to the original file, ignoring any checkpoint file.
  305.  
  306. If the buffer is modified and @hid[Revert File Confirm] is true, then the user
  307. is asked for confirmation.
  308. @enddefcom
  309.  
  310. @defcom[com "Insert File", bind (C-x C-r)]
  311. This command prompts for a file and inserts it at the point, pushing a buffer
  312. mark before inserting.
  313. @enddefcom
  314.  
  315. @defcom[com "Write Region"]
  316. This command prompts for a file and writes the text in the region out to it.
  317. @enddefcom
  318.  
  319. @defhvar[var "Add Newline at EOF on Writing File", val {:ask-user}]
  320. This variable controls whether some file writing commands add a newline at the
  321. end of the file if the last line is non-empty.
  322. @begin[description]
  323. @f[:ask-user]@\Ask the user whether to add a newline.
  324.  
  325. @f[t]@\Automatically add a newline and inform the user.
  326.  
  327. @nil@\Never add a newline and do not ask.
  328. @end[description]
  329. Some programs will lose the text on the last line or get an
  330. error when the last line does not have a newline at the end.
  331. @enddefhvar
  332.  
  333. @defhvar[var "Keep Backup Files", val {nil}]
  334. Whenever a file is written by @hid[Save File] and similar commands, the old
  335. file is renamed by appending "@f[.BAK]" to the name, ensuring that some version
  336. of the file will survive a system crash during the write.  If set to true, this
  337. backup file will not deleted even when the write successfully completes.
  338. @enddefhvar
  339.  
  340.  
  341. @subsection[Auto Save Mode]
  342.  
  343. @hid[Save] mode protects against loss of work in system crashes by periodically
  344. saving modified buffers in checkpoint files.
  345.  
  346. @defcom[com "Auto Save Mode"]
  347. This command turns on @hid[Save] mode if it is not on, and turns off when it is
  348. on.  @hid[Save] mode is on by default.
  349. @enddefcom
  350.  
  351. @defhvar[var "Auto Save Checkpoint Frequency", val {120}]
  352. @defhvar1[var "Auto Save Key Count Threshold", val {256}]
  353. These variables determine how often modified buffers in @hid[Save] mode will be
  354. checkpointed.  Checkpointing is done after
  355. @hid[Auto Save Checkpoint Frequency] seconds, or after
  356. @hid[Auto Save Key Count Threshold] keystrokes that modify the buffer
  357. (whichever comes first).  Either kind of checkpointing may be disabled by
  358. setting the corresponding variable to @nil.
  359. @enddefhvar
  360.  
  361. @defhvar[var "Auto Save Cleanup Checkpoints", val {t}]
  362. If this variable is true, then any checkpoint file for a buffer will be deleted
  363. when the buffer is successfully saved in its associated file.
  364. @enddefhvar
  365.  
  366. @defhvar[var "Auto Save Filename Pattern", val {"~A~A.CKP"}]
  367. @defhvar1[var "Auto Save Pathname Hook", val {make-unique-save-pathname}]
  368. These variables determine the naming of checkpoint files.
  369. @hid[Auto Save Filename Pattern] is a format string used to name the checkpoint
  370. files for buffers with associated files.  Format is called with two arguments:
  371. the directory and file namestrings of the associated file.
  372.  
  373. @hid[Auto Save Pathname Hook] is a function called by @hid[Save] mode to get a
  374. checkpoint pathname when there is no pathname associated with a buffer.  It
  375. should take a buffer as its argument and return either a pathname or @nil.  If
  376. a pathname is returned, then it is used as the name of the checkpoint file.  If
  377. the function returns @nil, or if the hook variable is @nil, then @hid[Save]
  378. mode is turned off in the buffer.  The default value for this variable returns
  379. a pathname in the default directory of the form "@w<@f[save-]@i[number]>",
  380. where @i[number] is a number used to make the file unique.
  381. @enddefhvar
  382.  
  383.  
  384. @subsection[Filename Defaulting and Merging]
  385. @index[merging, filename]
  386. @index[defaulting, filename]
  387. @index[filename defaulting]
  388. @label[merging]
  389. @index[pathnames]
  390. When @hemlock prompts for the name of a file, it always offers a default.
  391. Except for a few commands that have their own defaults, filename defaults are
  392. computed in a standard way.  If it exists, the associated file for the current
  393. buffer is used as the default, otherwise a more complex mechanism creates a
  394. default.
  395.  
  396. @defhvar[var "Pathname Defaults", val {(pathname "gazonk.del")}]
  397. @defhvar1[var "Last Resort Pathname Defaults Function"]
  398. @defhvar1[var "Last Resort Pathname Defaults", val {(pathname "gazonk")}]
  399. These variables control the computation of default filename defaults when the
  400. current buffer has no associated file.
  401.  
  402. @hid[Pathname Defaults] holds a "sticky" filename default.  Commands that
  403. prompt for files set this to the file specified, and the value is used as a
  404. basis for filename defaults.  It is undesirable to offer the unmodified value
  405. as a default, since it is usually the name of an existing file that we don't
  406. want to overwrite.  If the current buffer's name is all alphanumeric, then the
  407. default is computed by substituting the buffer name for the the name portion of
  408. @hid[Pathname Defaults].  Otherwise, the default is computed by calling
  409. @hid[Last Resort Pathname Defaults Function] with the buffer as an argument.
  410.  
  411. The default value of @hid[Last Resort Pathname Defaults Function] merges 
  412. @hid[Last Resort Pathname Defaults] with @hid[Pathname Defaults].
  413. Unlike @hid[Pathname Defaults], @hid[Last Resort Pathname Defaults] is not
  414. modified by file commands, so setting it to a silly name ensures that real
  415. files aren't inappropriately offered as defaults.
  416. @enddefhvar
  417.  
  418. When a default is present in the prompt for a file, @hemlock @i[merges] the
  419. given input with the default filename.  The semantics of merging, described in
  420. the Common Lisp manual, is somewhat involved, but @hemlock has a few rules it
  421. uses:
  422. @begin[enumerate]
  423. If @hemlock can find the user's input as a file on the @f["default:"] search
  424. list, then it forgoes merging with the displayed default.  Basically, the
  425. system favors the files in your current working directory over those found by
  426. merging with the defaults offered in the prompt.
  427.  
  428. Merging comes in two flavors, just merge with the displayed default's directory
  429. or just merge with the displayed default's @f[file-namestring].  If the user
  430. only responds with a directory specification, without any name or type
  431. information, then @hemlock merges the default's @f[file-namestring].  If the
  432. user responds with any name or type information, then @hemlock only merges with
  433. the default's directory.  Specifying relative directories in this second
  434. situation coordinates with the displayed defaults, not the current working
  435. directory.
  436. @end[enumerate]
  437.  
  438.  
  439. @subsection[Type Hooks and File Options]
  440. @index[mode comment]
  441. @index[type hooks]
  442. When a file is read either by @hid[Find File] or @hid[Visit File], @hemlock
  443. attempts to guess the correct mode in which to put the buffer, based on the
  444. file's @i[type] (the part of the filename after the last dot).  Any default
  445. action may be overridden by specifying the mode in the file's @i[file
  446. options].@index[modes]@index[package]
  447.  
  448. @label[file-options]@index[file options] 
  449. The user specifies file options with a special syntax on the first line of a
  450. file.  If the first line contains the string "@f[-*-]", then @hemlock
  451. interprets the text between the first such occurrence and the second, which
  452. must be contained in one line , as a list of @w{"@f<@i[option]: @i[value]>"}
  453. pairs separated by semicolons.  The following is a typical example:
  454. @begin[programexample]
  455. ;;; -*- Mode: Lisp, Editor; Package: Hemlock -*-
  456. @end[programexample]
  457.  
  458. These options are currently defined:
  459. @begin[description]
  460. Dictionary@\The argument is the filename of a spelling dictionary associated
  461. with this file.  The handler for this option merges the argument with the
  462. name of this file.  See @comref[Set Buffer Spelling Dictionary].
  463.  
  464. Log@\The argument is the name of the change log file associated with this file
  465. (see page @pageref[log-files]).  The handler for this option merges the
  466. argument with the name of this file.
  467.  
  468. Mode@\The argument is a comma-separated list of the names of modes to turn on
  469. in the buffer that the file is read into.
  470.  
  471. Package@\The argument is the name of the package to be used for reading code in
  472. the file.  This is only meaningful for Lisp code (see page
  473. @pageref[lisp-package].)
  474.  
  475. Editor@\The handler for this option ignores its argument and turns on
  476. @hid[Editor] mode (see @comref[Editor Mode]).
  477.  
  478. @end[description]
  479. If the option list contains no "@f[:]" then the entire string is used as
  480. the name of the major mode for the buffer.
  481.  
  482. @defcom[com "Process File Options"]
  483. This command processes the file options in the current buffer as described
  484. above.  This is useful when the options have been changed or when a file is
  485. created.
  486. @enddefcom
  487.  
  488.  
  489. @section[Windows]
  490. @index[windows]
  491.  
  492. @hemlock windows display a portion of a buffer's text.  See the section on
  493. @i[window groups], @ref[groups], for a discussion of managing windows on bitmap
  494. device.
  495.  
  496. @defcom[com "New Window", bind (C-x C-n)]
  497. This command prompts users for a new window which they can place anywhere on
  498. the screen.  This window is in its own group.  This only works with bitmap
  499. devices.
  500. @enddefcom
  501.  
  502. @defcom[com "Split Window", bind (C-x 2)]
  503. This command splits the current window roughly in half to make two windows.  If
  504. the current window is too small to be split, the command signals a user error.
  505. @enddefcom
  506.  
  507. @defcom[com "Next Window", bind (C-x n)]
  508. @defcom1[com "Previous Window", bind (C-x p)]
  509. These commands make the next or previous window the new current window, often
  510. changing the current buffer in the process.  When a window is created, it is
  511. arbitrarily made the next window of the current window.  The location of the
  512. next window is, in general, unrelated to that of the current window.
  513. @enddefcom
  514.  
  515. @defcom[com "Delete Window", bind (C-x C-d, C-x d)]
  516. @defcom1[com "Delete Next Window", bind (C-x 1)]
  517. @hid[Delete Window] makes the current window go away, making the next window
  518. current.  @hid[Delete Next Window] deletes the next window, leaving the current
  519. window unaffected.
  520.  
  521. On bitmap devices, if there is only one window in the group, either command
  522. deletes the group, making some window in another group the current window.  If
  523. there are no other groups, they signal a user error.
  524. @enddefcom
  525.  
  526. @defcom[com "Go to One Window"]
  527. This command deletes all window groups leaving one with the @hid[Default
  528. Initial Window X], @hid[Default Initial Window Y], @hid[Default Initial Window
  529. Width], and @hid[Default Initial Window Height].  This remaining window
  530. retains the contents of the current window.
  531. @enddefcom
  532.  
  533. @defcom[com "Line to Top of Window", bind (M-!)]
  534. @defcom1[com "Line to Center of Window", bind (M-#)]
  535. @index[scrolling]@hid[Line to Top of Window] scrolls the current window up
  536. until the current line is at the top of the screen.
  537.  
  538. @hid[Line to Center of Window] attempts to scroll the current window so that
  539. the current line is vertically centered.
  540. @enddefcom
  541.  
  542. @defcom[com "Scroll Next Window Down", bind (C-M-v)]
  543. @defcom1[com "Scroll Next Window Up", bind (C-M-V)]
  544. These commands are the same as @hid[Scroll Window Up] and
  545. @hid[Scroll Window Down] except that they operate on the next window.
  546. @enddefcom
  547.  
  548. @defcom[com "Refresh Screen", bind {C-l}]
  549. This command refreshes all windows, which is useful if the screen got trashed,
  550. centering the current window about the current line.  When the user supplies a
  551. positive argument, it scrolls that line to the top of the window.  When the
  552. argument is negative, the line that far from the bottom of the window is moved
  553. to the bottom of the window.  In either case when an argument is supplied, this
  554. command only refreshes the current window.
  555. @enddefcom
  556.  
  557.  
  558. @chap[Editing Documents]
  559. @index[documents, editing]
  560. Although @hemlock is not dedicated to editing documents as word processing
  561. systems are, it provides a number of commands for this purpose.  If @hemlock is
  562. used in conjunction with a text-formatting program, then its lack of complex
  563. formatting commands is no liability.
  564.  
  565.  
  566. @defcom[com "Text Mode"]
  567. This commands puts the current buffer into "Text" mode.
  568. @enddefcom
  569.  
  570.  
  571. @section[Sentence Commands]
  572. @index[sentence commands]
  573. A sentence is defined as a sequence of characters ending with a period,
  574. question mark or exclamation point, followed by either two spaces or a newline.
  575. A sentence may also be terminated by the end of a paragraph.  Any number of
  576. closing delimiters, such as brackets or quotes, may be between the punctuation
  577. and the whitespace.  This somewhat complex definition of a sentence is used so
  578. that periods in abbreviations are not misinterpreted as sentence ends.
  579.  
  580. @defcom[com "Forward Sentence", bind {M-a}]
  581. @defcom1[com "Backward Sentence", bind {M-e}]
  582. @index[motion, sentence]@hid[Forward Sentence] moves the point forward
  583. past the next sentence end. @hid[Backward Sentence] moves to the beginning
  584. of the current sentence. A prefix argument may be used as a repeat count.
  585. @enddefcom
  586.  
  587. @defcom[com "Forward Kill Sentence", bind {M-k}]
  588. @defcom1[com "Backward Kill Sentence", bind (C-x Delete, C-x Backspace)]
  589. @index[killing, sentence]@hid[Forward Kill Sentence] kills text from the
  590. point through to the end of the current sentence.  @hid[Backward Kill Sentence]
  591. kills from the point to the beginning of the current sentence.  A
  592. prefix argument may be used as a repeat count.
  593. @enddefcom
  594.  
  595. @defcom[com "Mark Sentence"]
  596. This command puts the point at the beginning and the mark at the end of the
  597. next or current sentence.
  598. @enddefcom
  599.  
  600.  
  601. @section[Paragraph Commands]
  602.  
  603. @index[paragraph commands]A paragraph may be delimited by a blank line or a
  604. line beginning with "@f[']" or "@f[.]", in which case the delimiting line is
  605. not part of the paragraph.  Other characters may be paragraph delimiters in
  606. some modes.  A line with at least one leading whitespace character may also
  607. introduce a paragraph and is considered to be part of the paragraph.  Any
  608. fill-prefix which is present on a line is disregarded for the purpose of
  609. locating a paragraph boundary.
  610.  
  611. @defcom[com "Forward Paragraph", bind (@bf<M-]>)]
  612. @defcom1[com "Backward Paragraph", bind (M-[)]
  613. @index[motion, paragraph]@index[paragraph, motion]@hid[Forward Paragraph]
  614. moves to the end of the current or next paragraph. @hid[Backward Paragraph]
  615. moves to the beginning of the current or previous paragraph.  A prefix
  616. argument may be used as a repeat count.
  617. @enddefcom
  618.  
  619. @defcom[com "Mark Paragraph", bind {M-h}]
  620. This command puts the point at the beginning and the mark at the end of the
  621. current paragraph.
  622. @enddefcom
  623.  
  624. @defhvar[var "Paragraph Delimiter Function", val {default-para-delim-function}]
  625. This variable holds a function that takes a mark as its argument and returns
  626. true when the line it points to should break the paragraph.
  627. @enddefhvar
  628.  
  629. @section[Filling]
  630.  
  631. @index[filling]@index[formatting]Filling is a coarse text-formatting
  632. process which attempts to make all the lines roughly the same length, but
  633. doesn't vary the amount of space between words.  Editing text may leave
  634. lines with all sorts of strange lengths; filling this text will return it
  635. to a moderately aesthetic form.
  636.  
  637. @defcom[com "Set Fill Column", bind (C-x f)]
  638. This command sets the fill column to the column that the point is currently at,
  639. or the one specified by the absolute value of prefix argument, if it is
  640. supplied.  The fill column is the column past which no text is permitted to
  641. extend.
  642. @enddefcom
  643.  
  644. @defcom[com "Set Fill Prefix", bind (C-x .)]
  645. This command sets the fill prefix to the text from the beginning of the
  646. current line to the point.  The fill-prefix is a string which filling commands
  647. leave at the beginning of every line filled.  This feature is useful for
  648. filling indented text or comments.
  649. @enddefcom
  650.  
  651. @defhvar[var "Fill Column", val {75}]
  652. @defhvar1[var "Fill Prefix", val {nil}]
  653. These variables hold the value of the fill prefix and fill column, thus
  654. setting these variables will change the way filling is done.  If
  655. @hid[Fill Prefix] is @nil, then there is no fill prefix.
  656. @enddefcom
  657.  
  658. @defcom[com "Fill Paragraph", bind {M-q}]
  659. @index[paragraph, filling]This command fills the text in the current or next
  660. paragraph.  The point is not moved.
  661. @enddefcom
  662.  
  663. @defcom[com "Fill Region", bind {M-g}]
  664. @index[region, filling]This command fills the text in the region.  Since
  665. filling can mangle a large quantity of text, this command asks for confirmation
  666. before filling a large region (see @hid[Region Query Size].)
  667. @enddefcom
  668.  
  669.  
  670. @defcom[com "Auto Fill Mode"]
  671. @index[modes, auto fill]This command turns on or off the @hid[Fill]
  672. minor mode in the current buffer.  When in @hid[Fill] mode, @bf[Space],
  673. @bf[Return] and @bf[Linefeed] are rebound to commands that check whether
  674. the point is past the fill column and fill the current line if it is.
  675. This enables typing text without having to break the lines manually.
  676.  
  677. If a prefix argument is supplied, then instead of toggling, the sign
  678. determines whether @hid[Fill] mode is turned off; a positive argument
  679. argument turns in on, and a negative one turns it off.
  680. @enddefcom
  681.  
  682. @defcom[com "Auto Fill Linefeed", stuff (bound to @bf[Linefeed] in @hid[Fill] mode)]
  683. @defcom1[com "Auto Fill Return", stuff (bound to @bf[Return] in @hid[Fill] mode)]
  684. @hid[Auto Fill Linefeed] fills the current line if it needs it and then goes to
  685. a new line and inserts the fill prefix.  @hid[Auto Fill Return] is similar, but
  686. does not insert the fill prefix on the new line.
  687. @enddefcom
  688.  
  689. @defcom[com "Auto Fill Space", stuff (bound to @bf[Space] in @hid[Fill] mode)]
  690. If no prefix argument is supplied, this command inserts a space and
  691. fills the current line if it extends past the fill column.  If the argument is
  692. zero, then it fills the line if needed, but does not insert a space.  If the
  693. argument is positive, then that many spaces are inserted without filling.
  694. @enddefcom
  695.  
  696. @defhvar[var "Auto Fill Space Indent", val {nil}]
  697. This variable determines how lines are broken by the auto fill commands.  If it
  698. is true, new lines are created using the @hid[Indent New Comment Line] command,
  699. otherwise the @hid[New Line] command is used.  Language modes should define
  700. this variable to be true so that auto fill mode can be used on code.
  701. @enddefhvar
  702.  
  703.  
  704. @section[Scribe Mode]
  705.  
  706. @hid[Scribe] mode provides a number of facilities useful for editing Scribe
  707. documents.  It is also sufficiently parameterizable to be adapted to other
  708. similar syntaxes.
  709.  
  710. @defcom[com "Scribe Mode"]
  711. @index[modes, scribe]This command puts the current buffer in @hid[Scribe] mode.
  712. Except for special Scribe commands, the only difference between @hid[Scribe]
  713. mode and @hid[Text] mode is that the rules for determining paragraph breaks are
  714. different.  In @hid[Scribe] mode, paragraphs delimited by Scribe commands are
  715. normally placed on their own line, in addition to the normal paragraph breaks.
  716. The main reason for doing this is that it prevents @hid[Fill Paragraph] from
  717. mashing these commands into the body of a paragraph.
  718. @enddefcom
  719.  
  720. @defcom[com "Insert Scribe Directive", stuff (@bf[C-h] in @hid[Scribe] mode)]
  721. This command prompts for a key-event to determine which Scribe directive to
  722. insert.  Directives are inserted differently depending on their kind:
  723. @begin[description]
  724. @i[environment]@\
  725. The current or next paragraph is enclosed in a begin-end pair:
  726. @f<@@begin[@i{directive}]> @i[paragraph] @f<@@end[@i{directive}]>.  If the
  727. current region is active, then this command encloses the region instead of the
  728. paragraph it would otherwise chose.
  729.  
  730. @i[command]@\
  731. The previous word is enclosed by @f<@@@i[directive][@i[word]]>.  If the
  732. previous word is already enclosed by a use of the same command, then the
  733. beginning of the command is extended backward by one word.
  734. @end[description]
  735.  
  736. Typing @bf[Home] or @bf[C-_] to this command's prompt will display a list of
  737. all the defined key-events on which it dispatches.
  738. @enddefcom
  739.  
  740. @defcom[com "Add Scribe Directive"]
  741. This command adds to the database of directives recognized by the 
  742. @hid[Insert Scribe Directive] command.  It prompts for the directive's name,
  743. the kind of directive (environment or command) and the key-event on which to
  744. dispatch.
  745. @enddefcom
  746.  
  747. @defcom[com "Add Scribe Paragraph Delimiter"]
  748. @defcom1[com "List Scribe Paragraph Delimiters"]
  749. @hid[Add Scribe Paragraph Delimiter] prompts for a string to add to the list of
  750. formatting commands that delimit paragraphs in @hid[Scribe] mode.  If the user
  751. supplies a prefix argument, then this command removes the string as a
  752. delimiter.
  753.  
  754. @hid[List Scribe Paragraph Delimiters] displays in a pop-up window the Scribe
  755. commands that delimit paragraphs.
  756. @enddefcom
  757.  
  758. @defhvar[var "Escape Character", val {#\@@}]
  759. @defhvar1[var "Close Paren Character", val {#\]}]
  760. @defhvar1[var "Open Paren Character", val {#\[}]
  761. These variables determine the characters used when a Scribe directive is
  762. inserted.
  763. @enddefhvar
  764.  
  765. @defcom[com "Scribe Insert Bracket"]
  766. @defhvar1[var "Scribe Bracket Table"]
  767. @hid[Scribe Insert Bracket] inserts a bracket (@bf[>], @bf[}], @bf[)], or
  768. @bf<]>), that caused its invocation, and then shows the matching bracket.
  769.  
  770. @hid[Scribe Bracket Table] holds a @f[simple-vector] indexed by character
  771. codes.  If a character is a bracket, then the entry for its @f[char-code]
  772. should be the opposite bracket.  If a character is not a bracket, then the
  773. entry should be @nil.
  774. @enddefcom
  775.  
  776.  
  777. @section[Spelling Correction]
  778. @index[spelling correction]
  779. @hemlock has a spelling correction facility based on the dictionary for the ITS
  780. spell program.  This dictionary is fairly small, having only 45,000 word or so,
  781. which means it fits on your disk, but it also means that many reasonably common
  782. words are not in the dictionary.  A correct spelling for a misspelled word will
  783. be found if the word is in the dictionary and is only erroneous in that it has
  784. a wrong character, a missing character, an extra character or a transposition
  785. of two characters.
  786.  
  787.  
  788. @defcom[com "Check Word Spelling", bind (M-$)]
  789. This command looks up the previous or current word in the dictionary and
  790. attempts to correct the spelling if it is misspelled.  There are four possible
  791. results of invoking this command:
  792. @begin[enumerate]
  793. This command displays the message "@f[Found it.]" in the echo area.  This means
  794. it found the word in the dictionary exactly as given.
  795.  
  796. This command displays the message "@f[Found it because of @i[word].]", where
  797. @i[word] is some other word with the same root but a different ending.  The
  798. word is no less correct than if the first message is given, but an additional
  799. piece of useless information is supplied to make you feel like you are using a
  800. computer.
  801.  
  802. The command prompts with "@f[Correction choice:]" in the echo area and lists
  803. possible correct spellings associated with numbers in a pop-up display.  Typing
  804. a number selects the corresponding correction, and the command replaces the
  805. erroneous word, preserving case as though by @hid[Query Replace].  Typing
  806. anything else rejects all the choices.
  807.  
  808. This commands displays the message "@f[Word not found.]".  The word is not in
  809. the dictionary and possibly spelled correctly anyway.  Furthermore, no
  810. similarly spelled words were found to offer as possible corrections.  If this
  811. happens, it is worth trying some alternate spellings since one of them might
  812. be close enough to some known words that this command could display.
  813. @end[enumerate]
  814. @enddefcom
  815.  
  816. @defcom[com "Correct Buffer Spelling"]
  817. This command scans the entire buffer looking for misspelled words and offers to
  818. correct them.  It creates a window into the @hid[Spell Corrections] buffer, and
  819. in this buffer it maintains a log of any actions taken by the user.  When this
  820. finds an unknown word, it prompts for a key-event.  The user has the following
  821. options:
  822. @begin[description]
  823. @bf[a]@\
  824.  Ignore this word.  If the command finds the word again, it will prompt again.
  825.  
  826. @bf[i]@\
  827.  Insert this word in the dictionary.
  828.  
  829. @bf[c]@\
  830.  Choose one of the corrections displayed in the @hid[Spell Corrections] window
  831. by specifying the correction number.  If the same misspelling is encountered
  832. again, then the command will make the same correction automatically, leaving a
  833. note in the log window.
  834.  
  835. @bf[r]@\
  836.  Prompt for a word to use instead of the misspelled one, remembering the
  837. correction as with @bf[c].
  838.  
  839. @binding[C-r]@\
  840.  Go into a recursive edit at the current position, and resume checking when the
  841. recursive edit is exited.
  842. @end[description]
  843. After this command completes, it deletes the log window leaving the buffer
  844. around for future reference.
  845. @enddefcom
  846.  
  847. @defhvar[var "Spell Ignore Uppercase", val {nil}]
  848. @index[case sensitivity]
  849. If this variable is true, then @hid[Auto Check Word Spelling] and @hid[Correct
  850. Buffer Spelling] will ignore unknown words that are all uppercase.  This is
  851. useful for acronyms and cryptic formatter directives.
  852. @enddefhvar
  853.  
  854. @defcom[com "Add Word to Spelling Dictionary", bind (C-x $)]
  855. This command adds the previous or current word to the spelling dictionary.
  856. @enddefcom
  857.  
  858. @defcom[com "Remove Word from Spelling Dictionary"]
  859. This command prompts for a word to remove from the spelling dictionary.  Due to
  860. the dictionary representation, removal of a word in the initial spelling
  861. dictionary will remove all words with the same root.  The user is asked for
  862. confirmation before removing a root word with valid suffix flags.
  863. @enddefcom
  864.  
  865. @defcom[com "List Incremental Spelling Insertions"]
  866. This command displays the incremental spelling insertions for the current
  867. buffer's associated spelling dictionary file.
  868. @enddefcom
  869.  
  870. @defcom[com "Read Spelling Dictionary"]
  871. This command adds some words from a file to the spelling dictionary.  The
  872. format of the file is a list of words, one on each line.
  873. @enddefcom
  874.  
  875. @defcom[com "Save Incremental Spelling Insertions"]
  876. This command appends incremental dictionary insertions to a file.  Any words
  877. added to the dictionary since the last time this was done will be appended to
  878. the file.  Except for @hid[Augment Spelling Dictionary], all the commands that
  879. add words to the dictionary put their insertions in this list.  The file is
  880. prompted for unless @hid[Set Buffer Spelling Dictionary] has been executed in
  881. the buffer.
  882. @enddefcom
  883.  
  884. @defcom[com "Set Buffer Spelling Dictionary"]
  885. This command Prompts for the dictionary file to associate with the current
  886. buffer.  If the specified dictionary file has not been read for any other
  887. buffer, then it is read.  Incremental spelling insertions from this buffer
  888. can be appended to this file with @hid[Save Incremental Spelling
  889. Insertions].  If a buffer has an associated spelling dictionary, then
  890. saving the buffer's associated file also saves any incremental dictionary
  891. insertions.  The @w<"@f[Dictionary: ]@i[file]"> file option may also be
  892. used to specify the dictionary for a buffer (see section
  893. @ref[file-options]).
  894. @enddefcom
  895.  
  896. @defhvar[var "Default User Spelling Dictionary", val {nil}]
  897. This variable holds the pathname of a dictionary to read the first time
  898. @hid[Spell] mode is entered in a given editing session.  When
  899. @hid[Set Buffer Spelling Dictionary] or the "@f[dictionary]" file option is
  900. used to specify a dictionary, this default one is read also.  It defaults to
  901. nil.
  902. @enddefhvar
  903.  
  904.  
  905. @subsection[Auto Spell Mode]
  906. @hid[Auto Spell Mode] checks the spelling of each word as it is typed.
  907. When an unknown word is typed the user is notified and allowed to take a
  908. number of actions to correct the word.
  909.  
  910. @defcom[com "Auto Spell Mode"]
  911. This command turns @hid[Spell] mode on or off in the current buffer.
  912. @enddefcom
  913.  
  914. @defcom[com "Auto Check Word Spelling",
  915.     stuff (bound to word delimiters in @hid[Spell] mode)]
  916. @defhvar1[var "Check Word Spelling Beep", val {t}]
  917. @defhvar1[var "Correct Unique Spelling Immediately", val {t}]
  918. This command checks the spelling of the word before the point, doing nothing if
  919. the word is in the dictionary.  If the word is misspelled but has a known
  920. correction previously supplied by the user, then this command corrects the
  921. spelling.  If there is no correction, then this displays a message in the echo
  922. area indicating the word is unknown.  An unknown word detected by this command
  923. may be corrected using the @hid[Correct Last Misspelled Word] command.  This
  924. command executes in addition to others bound to the same key; for example, if
  925. @hid[Fill] mode is on, any of its commands bound to the same keys as this
  926. command also run.
  927.  
  928. If @hid[Check Word Spelling Beep] is true, then this command will beep when an
  929. unknown word is found.  If @hid[Correct Unique Spelling Immediately] is true,
  930. then this command will immediately attempt to correct any unknown word,
  931. automatically making the correction if there is only one possible.
  932. @enddefhvar
  933.  
  934. @defcom[com "Undo Last Spelling Correction", bind (C-x a)]
  935. @defhvar1[var "Spelling Un-Correct Prompt for Insert", val {nil}]
  936. @hid[Undo Last Spelling Correction] undoes the last incremental spelling
  937. correction.  The "correction" is replaced with the old word, and the old word
  938. is inserted in the dictionary.  Any automatic replacement for the old word is
  939. eliminated.  When @hid[Spelling Un-Correct Prompt for Insert] is true, the user
  940. is asked to confirm the insertion into the dictionary.
  941. @enddefcom
  942.  
  943. @defcom[com "Correct Last Misspelled Word", bind (M-:)]
  944. This command places the cursor after the last misspelled word detected by the
  945. @hid[Auto Check Word Spelling] command and then prompts for a key-event on
  946. which it dispatches:
  947. @begin[description]
  948. @bf[c]@\
  949.  Display possible corrections in a pop-up window, and prompt for the one to
  950. make according to the corresponding displayed digit or letter.
  951.  
  952. @i[any digit]@\
  953.  Similar to @bf[c] @i[digit], but immediately makes the correction, dispensing
  954. with display of the possible corrections.  This is shorter, but only works when
  955. there are less than ten corrections.
  956.  
  957. @bf[i]@\
  958.  Insert the word in the dictionary.
  959.  
  960. @bf[r]@\
  961.  Replace the word with another.
  962.  
  963. @binding[Backspace, Delete, n]@\
  964.  Skip this word and try again on the next most recently misspelled word.
  965.  
  966. @binding[C-r]@\
  967.  Enter a recursive edit at the word, exiting the command when the recursive
  968. edit is exited.
  969.  
  970. @binding[Escape]@\
  971.  Exit and forget about this word.
  972. @end[description]
  973. As in @hid[Correct Buffer Spelling], the @bf[c] and @bf[r] commands add the
  974. correction to the known corrections.
  975. @enddefcom
  976.  
  977.  
  978.  
  979. @chap[Managing Large Systems]
  980.  
  981. @hemlock provides three tools which help to manage large systems:
  982. @begin[enumerate]
  983. File groups, which provide several commands that operate on all the files
  984. in a possibly large collection, instead of merely on a single buffer.
  985.  
  986. A source comparison facility with semi-automatic merging, which can be used
  987. to compare and merge divergent versions of a source file.
  988.  
  989. A change log facility, which maintains a single file containing a record of the
  990. edits done on a system.
  991. @end[enumerate]
  992.  
  993.  
  994. @section[File Groups]
  995.  
  996. @index[file groups]@index[searching, group]@index[replacing, group]
  997. A file group is a set of files, upon which various editing operations can be
  998. performed.  The files in a group are specified by a file in the following
  999. format:
  1000. @begin[itemize]
  1001. Any line which begins with one "@f[@@]" is ignored.
  1002.  
  1003. Any line which does not begin with an "@f[@@]" is the name of a file in the
  1004. group.
  1005.  
  1006. A line which begins with "@f[@@@@]" specifies another file having this
  1007. syntax, which is recursively examined to find more files in the group.
  1008. @end[itemize]
  1009. This syntax is used for historical reasons.  Although any number of file groups
  1010. may be read into @hemlock, there is only one @i[active group], which is the
  1011. file group implicitly used by all of the file group commands.  
  1012. Page @pageref[compile-group-command] describes the @hid[Compile Group] command.
  1013.  
  1014. @defcom[com "Select Group"]
  1015. This command prompts for the name of a file group to make the active group.
  1016. If the name entered is not the name of a group whose definition has been
  1017. read, then the user is prompted for the name of a file to read the group
  1018. definition from.  The name of the default pathname is the name of the
  1019. group, and the type is "@f[upd]".
  1020. @enddefcom
  1021.  
  1022. @defcom[com "Group Query Replace"]
  1023. This command prompts for target and replacement strings and then executes an
  1024. interactive string replace on each file in the active group.  This reads in
  1025. each file as if @hid[Find File] were used and processes it as if @hid[Query
  1026. Replace] were executing.
  1027. @enddefcom
  1028.  
  1029. @defcom[com "Group Replace"]
  1030. This is like @hid[Group Query Replace] except that it executes a
  1031. non-interactive replacement, similar to @hid[Replace String].
  1032. @enddefcom
  1033.  
  1034. @defcom[com "Group Search"]
  1035. This command prompts for a string and then searches for it in each file in the
  1036. active group.  This reads in each file as if @hid[Find File] were used.  When
  1037. it finds an occurrence, it prompts the user for a key-event indicating what
  1038. action to take.  The following commands are defined:
  1039. @begin[description]
  1040. @binding[Escape, Space, y]@\
  1041.  Exit @hid[Group Search].
  1042.  
  1043. @binding[Delete, Backspace, n]@\
  1044.  Continue searching for the next occurrence of the string.
  1045.  
  1046. @binding[!]@\
  1047.  Continue the search at the beginning of the next file, skipping the remainder
  1048. of the current file.
  1049.  
  1050. @binding[C-r]@\
  1051.  Go into a recursive edit at the current location, and continue the search when
  1052. it is exited.
  1053. @end[description]
  1054. @enddefcom
  1055.  
  1056. @defhvar[var "Group Find File", val {nil}]
  1057. The group searching and replacing commands read each file into its own buffer
  1058. using @hid[Find File].  Since this may result in large amounts of memory being
  1059. consumed by unwanted buffers, this variable controls whether to delete the
  1060. buffer after processing it.  When this variable is false, the default, the
  1061. commands delete the buffer if it did not previously exist; however, regardless
  1062. of this variable, if the user leaves the buffer modified, the commands will not
  1063. delete it.
  1064. @enddefhvar
  1065.  
  1066. @defhvar[var "Group Save File Confirm", val {t}]
  1067. If this variable is true, the group searching and replacing commands ask for
  1068. confirmation before saving any modified file.  The commands attempt to save
  1069. each file processed before going on to the next one in the group.
  1070. @enddefhvar
  1071.  
  1072.  
  1073. @section[Source Comparison]
  1074. @index[buffer, merging]
  1075. @index[buffer, comparison]
  1076. @index[source comparison]
  1077.  
  1078. These commands can be used to find exactly how the text in two buffers differs,
  1079. and to generate a new version that combines features of both versions.
  1080.  
  1081. @defhvar[var "Source Compare Default Destination", val {"Differences"}]
  1082. This is a sticky default buffer name to offer when comparison commands prompt
  1083. for a buffer in which to insert the results.
  1084. @enddefhvar
  1085.  
  1086. @defcom[com "Compare Buffers"]
  1087. This command prompts for three buffers and then does a buffer comparison.
  1088. The first two buffers must exist, as they are the buffers to be compared.
  1089. The last buffer, which is created if it does not exist, is the buffer to
  1090. which output is directed.  The output buffer is selected during the
  1091. comparison so that its progress can be monitored.  There are various variables
  1092. that control exactly how the comparison is done.
  1093.  
  1094. If a prefix argument is specified, then only only the lines in the the regions
  1095. of the two buffers are compared.
  1096. @enddefcom
  1097.  
  1098. @defcom[com "Buffer Changes"]
  1099. This command compares the contents of the current buffer with the disk version
  1100. of the associated file.  It reads the file into the buffer 
  1101. @hid[Buffer Changes File], and generates the comparison in the buffer
  1102. @hid[Buffer Changes Result].  As with @hid[Compare Buffers], the output buffer
  1103. is displayed in the current window.
  1104. @enddefcom
  1105.  
  1106. @defcom[com "Merge Buffers"]
  1107. This command functions in a very similar fashion to @hid[Compare Buffers], the
  1108. difference being that a version which is a combination of the two buffers being
  1109. compared is generated in the output buffer.  This copies text that is identical
  1110. in the two comparison buffers to the output buffer.  When it encounters a
  1111. difference, it displays the two differing sections in the output buffer and
  1112. prompts the user for a key-event indicating what action to take.  The following
  1113. commands are defined:
  1114. @begin[description]
  1115. @bf[1]@\
  1116.  Use the first version of the text.
  1117.  
  1118. @bf[2]@\
  1119.  Use the second version.
  1120.  
  1121. @bf[b]@\
  1122.  Insert the string @w<"@f[**** MERGE LOSSAGE ****]"> followed by both versions.
  1123. This is useful if the differing sections are too complex, or it is unclear
  1124. which is the correct version.  If you cannot make the decision conveniently at
  1125. this point, you can later search for the marking string above.
  1126.  
  1127. @binding[C-r]@\
  1128.  Do a recursive edit and ask again when the edit is exited.
  1129. @end[description]
  1130. @enddefcom
  1131.  
  1132.  
  1133. @defhvar[var "Source Compare Ignore Case", val {nil}]
  1134. @index[case sensitivity]
  1135. If this variable is non-@nil, @hid[Compare Buffers] and @hid[Merge Buffers]
  1136. will do comparisons case-insensitively.
  1137. @enddefhvar
  1138.  
  1139. @defhvar[var "Source Compare Ignore Indentation", val {nil}] 
  1140. If this variable is non-@nil, @hid[Compare Buffers] and @hid[Merge Buffers]
  1141. ignore initial whitespace when comparing lines.
  1142. @enddefhvar
  1143.  
  1144. @defhvar[var "Source Compare Ignore Extra Newlines", val {t}]
  1145. If this variable is true, @hid[Compare Buffers] and @hid[Merge Buffers]
  1146. will treat all groups of newlines as if they were a single newline.
  1147. @enddefhvar
  1148.  
  1149. @defhvar[var "Source Compare Number of Lines", val {3}]
  1150. This variable controls the number of lines @hid[Compare Buffers] and
  1151. @hid[Merge Buffers] will compare when resynchronizing after a difference
  1152. has been encountered.
  1153. @enddefhvar
  1154.  
  1155.  
  1156. @section[Change Logs]
  1157. @label[log-files]
  1158. @index[edit history]
  1159. @index[change log]
  1160.  
  1161. The @hemlock change log facility encourages the recording of changes to a
  1162. system by making it easy to do so.  The change log is kept in a separate file
  1163. so that it doesn't clutter up the source code.  The name of the log for a file
  1164. is specified by the @f[Log] file option (see page @pageref[file-options].)
  1165.  
  1166. @defcom[com "Log Change"]
  1167. @defhvar1[var "Log Entry Template"]
  1168. @hid[Log Change] makes a new entry in the change log associated with the file.
  1169. Any changes in the current buffer are saved, and the associated log file is
  1170. read into its own buffer.  The name of the log file is determined by merging
  1171. the name specified in the @f[Log] option with the current buffer's file name,
  1172. so it is not usually necessary to put the full name there.  After inserting a
  1173. template for the log entry at the beginning of the buffer, the command enters a
  1174. recursive edit (see page @pageref[recursive-edits]) so that the text of the
  1175. entry may be filled in.  When the user exits the recursive edit, the log file
  1176. is saved.
  1177.  
  1178. The variable @hid[Log Entry Template] determines the format of the change log
  1179. entry.  Its value is a @clisp @f[format] control string.  The format string is
  1180. passed three string arguments: the full name of the file, the creation date for
  1181. the file and the name of the file author.  If the creation date is not
  1182. available, the current date is used.  If the author is not available then @nil
  1183. is passed.  If there is an @f[@@] in the template, then it is deleted and the
  1184. point is left at that position.
  1185. @enddefcom
  1186.  
  1187.  
  1188.  
  1189. @comment[@chap (Special Modes)]
  1190. @include(special-modes)
  1191.  
  1192.  
  1193.  
  1194. @chap[Editing Programs]
  1195.  
  1196.  
  1197. @section[Comment Manipulation]
  1198. @index[comment manipulation]
  1199. @hemlock has commenting commands which can be used in almost any language.  The
  1200. behavior of these commands is determined by several @hemlock variables which
  1201. language modes should define appropriately.
  1202.  
  1203. @defcom[com "Indent for Comment", bind (M-;)]
  1204. @index[indentation, comment]@label[comment-indentation]
  1205. This is the most basic commenting command.  If there is already a comment on
  1206. the current line, then this moves the point to the start of the comment.  If
  1207. there no comment, this creates an empty one.
  1208.  
  1209. This command normally indents the comment to start at @hid[Comment Column].
  1210. The comment indents differently in the following cases:
  1211. @begin[enumerate]
  1212. If the comment currently starts at the beginning of the line, or if the last
  1213. character in the @hid[Comment Start] appears three times, then the comment
  1214. remains unmoved.
  1215.  
  1216. If the last character in the @hid[Comment Start] appears two times, then the
  1217. comment is indented like a line of code.
  1218.  
  1219. If text on the line prevents the comment occurring in the desired position,
  1220. this places the comment at the end of the line, separated from the text by a
  1221. space.
  1222. @end[enumerate]
  1223. Although the rules about replication in the comment start are oriented toward
  1224. Lisp commenting styles, you can exploit these properties in other languages.
  1225.  
  1226. When given a prefix argument, this command indents any existing comment on that
  1227. many consecutive lines.  This is useful for fixing up the indentation of a
  1228. group of comments.
  1229. @enddefcom
  1230.  
  1231. @defcom[com "Indent New Comment Line", bind {M-j, M-Linefeed}]
  1232. This commend ends the current comment and starts a new comment on a blank line,
  1233. indenting the comment the same way that @hid[Indent for Comment] does.
  1234. When not in a comment, this command is the same as @hid[Indent New Line].
  1235. @enddefcom
  1236.  
  1237. @defcom[com "Up Comment Line", bind {M-p}]
  1238. @defcom1[com "Down Comment Line", bind {M-n}]
  1239. These commands are similar to @hid[Previous Line] or @hid[Next Line]
  1240. followed by @hid[Indent for Comment].  Any empty comment on the current line is
  1241. deleted before moving to the new line.
  1242. @enddefcom
  1243.  
  1244. @defcom[com "Kill Comment", bind (C-M-;)]
  1245. This command kills any comment on the current line.  When given a prefix
  1246. argument, it kills comments on that many consecutive lines.  @hid[Undo] will
  1247. restore the unmodified text.
  1248. @enddefcom
  1249.  
  1250. @defcom[com "Set Comment Column", bind (C-x ;)]
  1251. This command sets the comment column to its prefix argument.  If used without a
  1252. prefix argument, it sets the comment column to the column the point is at.
  1253. @enddefcom
  1254.  
  1255. @defhvar[var "Comment Start", val {nil}]
  1256. @defhvar1[var "Comment End", val {nil}]
  1257. @defhvar1[var "Comment Begin", val {nil}]
  1258. @defhvar1[var "Comment Column", val {0}]
  1259. These variables determine the behavior of the comment commands.
  1260. @begin[description]
  1261. @hid[Comment Start]@\The string which indicates the start of a comment.  If
  1262. this is @nil, then there is no defined comment syntax.
  1263.  
  1264. @hid[Comment End]@\The string which ends a comment.  If this is @nil, then
  1265. the comment is terminated by the end of the line.
  1266.  
  1267. @hid[Comment Begin]@\The string inserted to begin a new comment.
  1268.  
  1269. @hid[Comment Column]@\The column that normal comments start at.
  1270. @end[description]
  1271. @enddefcom
  1272.  
  1273.  
  1274. @section[Indentation]
  1275. @label[indentation]
  1276. @index[indentation]
  1277. Nearly all programming languages have conventions for indentation or leading
  1278. whitespace at the beginning of lines.  The @hemlock indentation facility is
  1279. integrated into the command set so that it interacts well with other features
  1280. such as filling and commenting.
  1281.  
  1282. @defcom[com "Indent", bind (Tab, C-i)]
  1283. This command indents the current line.  With a prefix argument, indents that
  1284. many lines and moves down.  Exactly what constitutes indentation depends on the
  1285. current mode (see @hid[Indent Function]).
  1286. @enddefcom
  1287.  
  1288. @defcom[com "Indent New Line", bind (Linefeed)]
  1289. This command starts a new indented line.  Deletes any whitespace before the
  1290. point and inserts indentation on a blank line.  The effect of this is similar
  1291. to @binding[Return] followed by @binding[Tab].  The prefix argument is passed
  1292. to @hid[New Line], which is used to insert the blank line.
  1293. @enddefcom
  1294.  
  1295. @defcom[com "Indent Region", bind (C-M-\)]
  1296. This command indents every line in the region.  It may be undone with
  1297. @hid[Undo].
  1298. @enddefcom
  1299.  
  1300. @defcom[com "Back to Indentation", bind {M-m, C-M-m}]
  1301. @index[motion, indentation]
  1302. This command moves point to the first non-whitespace character on the current
  1303. line.
  1304. @enddefcom
  1305.  
  1306. @defcom[com "Delete Indentation", bind (M-^, C-M-^)]
  1307. @hid[Delete Indentation] joins the current line with the previous one, deleting
  1308. excess whitespace.  This operation is the inverse of the @bf[Linefeed] command
  1309. in most modes.  Usually this leaves one space between the two joined lines, but
  1310. there are several exceptions.
  1311.  
  1312. The non-whitespace immediately surrounding the deleted line break determine the
  1313. amount of space inserted.
  1314. @begin[enumerate]
  1315. If the preceding character is an "@f[(]" or the following character is a
  1316. "@f[)]", then this inserts no space.
  1317.  
  1318. If the preceding character is a newline, then this inserts no space.  This will
  1319. happen if the previous line was blank.
  1320.  
  1321. If the preceding character is a sentence terminator, then this inserts two
  1322. spaces.
  1323. @end[enumerate]
  1324.  
  1325. When given a prefix argument, this command joins the current and next lines,
  1326. rather than the previous and current lines.
  1327. @enddefcom
  1328.  
  1329. @defcom[com "Quote Tab", bind (M-Tab)]
  1330. This command inserts a tab character.
  1331. @enddefcom
  1332.  
  1333. @defcom[com "Indent Rigidly", bind (C-x Tab, C-x C-i)]
  1334. This command changes the indentation of all the lines in the region.  Each
  1335. line is moved to the right by the number of spaces specified by the prefix
  1336. argument, which defaults to eight.  A negative prefix argument moves lines
  1337. left.
  1338. @enddefcom
  1339.  
  1340. @defcom[com "Center Line"]
  1341. This indents the current line so that it is centered between the left margin
  1342. and @hvarref[Fill Column].  If a prefix argument is supplied, then it is used
  1343. as the width instead of @hid[Fill Column].
  1344. @enddefcom
  1345.  
  1346. @defhvar[var "Indent Function", val {tab-to-tab-stop}]
  1347. The value of this variable determines how indentation is done, and it is a
  1348. function which is passed a mark as its argument.  The function should indent
  1349. the line which the mark points to.  The function may move the mark around on
  1350. the line.  The mark will be @f[:left-inserting].  The default simply inserts a
  1351. tab character at the mark.
  1352. @enddefhvar
  1353.  
  1354. @defhvar[var "Indent with Tabs", val {indent-using-tabs}]
  1355. @defhvar1[var "Spaces per Tab", val {8}]
  1356. @hid[Indent with Tabs] holds a function that takes a mark and a number of
  1357. spaces.  The function will insert a maximum number of tabs and a minimum number
  1358. of spaces at mark to move the specified number of columns.  The default
  1359. definition uses @hid[Spaces per Tab] to determine the size of a tab.  @i[Note,]
  1360. @hid[Spaces per Tab] @i[is not used everywhere in @hemlock yet, so changing
  1361. this variable could have unexpected results.]
  1362. @enddefhvar
  1363.  
  1364.  
  1365. @section[Language Modes]
  1366.  
  1367. @hemlock@comment{}'s language modes are currently fairly crude, but probably
  1368. provide better programming support than most non-extensible editors.
  1369.  
  1370. @defcom[com "Pascal Mode"]
  1371. @index[indentation, pascal]@index[modes, pascal]This command sets the current
  1372. buffer's major mode to @hid[Pascal].  @hid[Pascal] mode borrows parenthesis
  1373. matching from Scribe mode and indents lines under the previous line.
  1374. @enddefcom
  1375.  
  1376.  
  1377. @chap[Editing Lisp]
  1378. @index[lisp, editing]
  1379. @hemlock provides a large number of powerful commands for editing Lisp code.
  1380. It is possible for a text editor to provide a much higher level of support for
  1381. editing Lisp than ordinary programming languages, since its syntax is much
  1382. simpler.
  1383.  
  1384.  
  1385. @section[Lisp Mode]
  1386. @index[lisp mode]
  1387. @index[modes, lisp]
  1388. @hid[Lisp] mode is a major mode used for editing Lisp code.  Although most
  1389. Lisp specific commands are globally bound, @hid[Lisp] mode is necessary to
  1390. enable Lisp indentation, commenting, and parenthesis-matching.  Whenever the
  1391. user or some @hemlock mechanism turns on @hid[Lisp] mode, the mode's setup
  1392. includes locally setting @hid[Current Package] (see section @ref[lisp-package])
  1393. in that buffer if its value is non-existent there; the value used is
  1394. @f["USER"].
  1395.  
  1396. @defcom[com "Lisp Mode"]
  1397. This command sets the major mode of the current buffer to @hid[Lisp].
  1398. @enddefcom
  1399.  
  1400.  
  1401. @section[Form Manipulation]
  1402. @index[form manipulation]
  1403. These commands manipulate Lisp forms, the printed representations of Lisp
  1404. objects.  A form is either an expression balanced with respect to parentheses
  1405. or an atom such as a symbol or string.
  1406.  
  1407. @defcom[com "Forward Form", bind (C-M-f)]
  1408. @defcom1[com "Backward Form", bind (C-M-b)]
  1409. @index[motion, form]@hid[Forward Form] moves to the end of the current or
  1410. next form, while @hid[Backward Form] moves to the beginning of the current
  1411. or previous form.  A prefix argument is treated as a repeat count.
  1412. @enddefcom
  1413.  
  1414. @defcom[com "Forward Kill Form", bind (C-M-k)]
  1415. @defcom1[com "Backward Kill Form", bind (C-M-Delete, C-M-Backspace)]
  1416. @index[killing, form]@hid[Forward Kill Form] kills text from the point to
  1417. the end of the current form.  If at the end of a list, but inside the close
  1418. parenthesis, then kill the close parenthesis.  @hid[Backward Kill Form] is
  1419. the same, except it goes in the other direction.  A prefix argument is
  1420. treated as a repeat count.
  1421. @enddefcom
  1422.  
  1423. @defcom[com "Mark Form", bind (C-M-@@)]
  1424. This command sets the mark at the end of the current or next form.
  1425. @enddefcom
  1426.  
  1427. @defcom[com "Transpose Forms", bind (C-M-t)]
  1428. This command transposes the forms before and after the point and moves
  1429. forward.  A prefix argument is treated as a repeat count.  If the prefix
  1430. argument is negative, then the point is moved backward after the
  1431. transposition is done, reversing the effect of the equivalent positive
  1432. argument.
  1433. @enddefcom
  1434.  
  1435. @defcom[com "Insert ()", bind {M-(}]
  1436. This command inserts an open and a close parenthesis, leaving the point
  1437. inside the open parenthesis.  If a prefix argument is supplied, then the
  1438. close parenthesis is put at the end of the form that many forms from the
  1439. point.
  1440. @enddefcom
  1441.  
  1442. @defcom[com "Extract Form"]
  1443. This command replaces the current containing list with the next form.  The
  1444. entire affected area is pushed onto the kill ring.  If an argument is supplied,
  1445. that many upward levels of list nesting is replaced by the next form.  This is
  1446. similar to @hid[Extract List], but this command is more generally useful since
  1447. it works on any kind of form; it is also more intuitive since it operates on
  1448. the next form as many @hid[Lisp] mode commands do.
  1449. @enddefcom
  1450.  
  1451.  
  1452. @section[List Manipulation]
  1453.  
  1454. @index[list manipulation]List commands are similar to form commands, but
  1455. they only pay attention to lists, ignoring any atomic objects that may
  1456. appear.  These commands are useful because they can skip over many symbols
  1457. and move up and down in the list structure.
  1458.  
  1459. @defcom[com "Forward List", bind (C-M-n)]
  1460. @defcom1[com "Backward List", bind (C-M-p)]
  1461. @index[motion, list]@hid[Forward List] moves the point to immediately
  1462. after the end of the next list at the current level of list structure.  If
  1463. there is not another list at the current level, then it moves up past
  1464. the end of the containing list.
  1465. @hid[Backward List] is identical, except that it moves backward and leaves
  1466. the point at the beginning of the list.  The prefix argument is used as a
  1467. repeat count.
  1468. @enddefcom
  1469.  
  1470. @defcom[com "Forward Up List", bind {C-M-@bf<)>}]
  1471. @defcom1[com "Backward Up List", bind (C-M-@bf<(>, C-M-u)]
  1472. @hid[Forward Up List] moves to after the end of the enclosing list.
  1473. @hid[Backward Up List] moves to the beginning.  The prefix argument is used
  1474. as a repeat count.
  1475. @enddefcom
  1476.  
  1477. @defcom[com "Down List", bind (C-M-d)]
  1478. This command moves to just after the beginning of the next list.  The
  1479. prefix argument is used as a repeat count.
  1480. @enddefcom
  1481.  
  1482. @defcom[com "Extract List", bind (C-M-x)]
  1483. This command "extracts" the current list from the list which contains it.
  1484. The outer list is deleted, leaving behind the current list.  The entire
  1485. affected area is pushed on the kill ring, so that this possibly catastrophic
  1486. operation can be undone.  The prefix argument is used as a repeat count.
  1487. @enddefcom
  1488.  
  1489.  
  1490.  
  1491. @section[Defun Manipulation]
  1492.  
  1493. @index[defun manipulation]A @i[defun] is a list whose open parenthesis is
  1494. against the left margin.  It is called this because an occurrence of the
  1495. @f[defun] top level form usually satisfies this definition, but
  1496. other top level forms such as a @f[defstruct] and @f[defmacro] work just as
  1497. well.
  1498.  
  1499. @defcom[com "End of Defun", bind (@bf<C-M-e, C-M-]>)]
  1500. @defcom1[com "Beginning of Defun", bind (C-M-a, C-M-[)]
  1501. @index[motion, defun]@hid[End of Defun] moves to the end of the current
  1502. or next defun. @hid[Beginning of Defun] moves to the beginning of the
  1503. current or previous defun.  @hid[End of Defun] will not work if the
  1504. parentheses are not balanced.
  1505. @enddefcom
  1506.  
  1507. @defcom[com "Mark Defun", bind (C-M-h)]
  1508. This command puts the point at the beginning and the mark at the end of the
  1509. current or next defun.
  1510. @enddefcom
  1511.  
  1512.  
  1513.  
  1514. @section[Indentation]
  1515.  
  1516. @index[indentation, lisp]
  1517. One of the most important features provided by @hid[Lisp] mode is automatic
  1518. indentation of Lisp code.  Since unindented Lisp is unreadable, poorly indented
  1519. Lisp is hard to manage, and inconsistently indented Lisp is subtly misleading.
  1520. See section @ref[indentation] for a description of the general-purpose
  1521. indentation commands.  @hid[Lisp] mode uses these indentation rules:
  1522. @begin[itemize]
  1523. If in a semicolon (@f[;]) comment, then use the standard comment indentation
  1524. rules.  See page @pageref[comment-indentation].
  1525.  
  1526. If in a quoted string, then indent to the column one greater than the column
  1527. containing the opening double quote.  This is exactly what you want in function
  1528. documentation strings and wrapping @f[error] strings.
  1529.  
  1530. If there is no enclosing list, then use no indentation.
  1531.  
  1532. If enclosing list resembles a call to a known macro or special-form, then the
  1533. first few arguments are given greater indentation and the first body form is
  1534. indented two spaces.  If the first special argument is on the same line as the
  1535. beginning of the form, then following special arguments will be indented to the
  1536. start of the first special argument, otherwise all special arguments are
  1537. indented four spaces.
  1538.  
  1539. If the previous form starts on its own line, then the indentation is copied
  1540. from that form.  This rule allows the default indentation to be overridden:
  1541. once a form has been manually indented to the user's satisfaction, subsequent
  1542. forms will be indented in the same way.
  1543.  
  1544. If the enclosing list has some arguments on the same line as the form start,
  1545. then subsequent arguments will be indented to the start of the first argument.
  1546.  
  1547. If the enclosing list has no argument on the same line as the form start, then
  1548. arguments will be indented one space.
  1549. @end[itemize]
  1550.  
  1551.  
  1552. @defcom[com "Indent Form", bind (C-M-q)]
  1553. This command indents all the lines in the current form, leaving the point
  1554. unmoved.  This is undo-able.
  1555. @enddefcom
  1556.  
  1557. @defcom[com "Fill Lisp Comment Paragraph",
  1558.     stuff <bound to @bf[M-q] in @hid[Lisp] mode>]
  1559. @defhvar1[var "Fill Lisp Comment Paragraph Confirm", val {t}]
  1560. This fills a flushleft or indented Lisp comment.  This also fills Lisp string
  1561. literals using the proper indentation as a filling prefix.  When invoked
  1562. outside of a comment or string, this tries to fill all contiguous lines
  1563. beginning with the same initial, non-empty blankspace.  When filling a comment,
  1564. the current line is used to determine a fill prefix by taking all the initial
  1565. whitespace on the line, the semicolons, and any whitespace following the
  1566. semicolons.
  1567.  
  1568. When invoked outside of a comment or string, this command prompts for
  1569. confirmation before filling.  It is useful to use this for filling long
  1570. @f[export] lists or other indented text or symbols, but since this is a less
  1571. common use, this command tries to make sure that is what you wanted.  Setting
  1572. @hid[Fill Lisp Comment Paragraph Confirm] to @nil inhibits the confirmation
  1573. prompt.
  1574. @enddefcom
  1575.  
  1576. @defcom[com "Defindent", bind (C-M-#)]
  1577. This command prompts for the number of special arguments to associate with
  1578. the symbol at the beginning of the current or containing list.
  1579. @enddefcom
  1580.  
  1581. @defhvar[var "Indent Defanything", val {2}]
  1582. This is the number of special arguments implicitly assumed to be supplied in
  1583. calls to functions whose names begin with "@f[def]".  If set to @nil, this
  1584. feature is disabled.
  1585. @enddefhvar
  1586.  
  1587. @defcom[com "Move Over )", bind {M-)}]
  1588. This command moves past the next close parenthesis and then does the equivalent
  1589. of @hid[Indent New Line].
  1590. @enddefcom       
  1591.  
  1592.  
  1593. @section[Parenthesis Matching]
  1594.  
  1595. @index[parenthesis matching]Another very important facility provided by
  1596. @hid[Lisp] mode is @i[parenthesis matching].  Two different styles of
  1597. parenthesis matching are supported: highlighting and pausing.
  1598.  
  1599. @defhvar[var "Highlight Open Parens", val {t}]
  1600. @defhvar1[var "Open Paren Highlighting Font", val {nil}]
  1601. When @hid[Highlight Open Parens] is true, and a close paren is immediately
  1602. before the point, then @hemlock displays the matching open paren in @hid[Open
  1603. Paren Highlighting Font].
  1604.  
  1605. @hid[Open Paren Highlighting Font] is the string name of the font used for
  1606. paren highlighting.  Only the "@f[(]" character is used in this font.  If null,
  1607. then a reasonable default is chosen.  The highlighting font is read at
  1608. initialization time, so this variable must be set before the editor is first
  1609. entered to have any effect.
  1610. @enddefhvar
  1611.  
  1612. @defcom[com "Lisp Insert )", stuff <bound to @bf[)] in @hid[Lisp] mode>]
  1613. @defhvar1[var "Paren Pause Period", val {0.5}]
  1614. This command inserts a close parenthesis and then attempts to display the
  1615. matching open parenthesis by placing the cursor on top of it for
  1616. @hid[Paren Pause Period] seconds.  If there is no matching parenthesis then
  1617. beep.  If the matching parenthesis is off the top of the screen, then the line
  1618. on which it appears is displayed in the echo area.  Paren pausing may be
  1619. disabled by setting @hid[Paren Pause Period] to @nil. 
  1620. @enddefcom
  1621.  
  1622. The initial values shown for @hid[Highlight Open Parens] and @hid[Paren Pause
  1623. Period] are only approximately correct.  Since paren highlighting is only
  1624. meaningful in Lisp mode, @hid[Highlight Open Parens] is false globally, and
  1625. has a mode-local value of @true in Lisp mode.  It it redundant to do both
  1626. kinds of paren matching, so there is also a binding of @hid[Paren Pause Period]
  1627. to @false in Lisp mode.
  1628.  
  1629. Paren highlighting is only supported under @windows, so the above defaults are
  1630. conditional on the device type.  If @hemlock is started on a terminal, the
  1631. initialization code makes Lisp mode bindings of @false and @f[0.5] for
  1632. @hid[Highlight Open Parens] and @hid[Paren Pause Period].  Since these
  1633. alternate default bindings are made at initialization time, the only way to
  1634. affect them is to use the @f[after-editor-initializations] macro.
  1635.  
  1636.  
  1637. @section[Parsing Lisp]
  1638. Lisp mode has a fairly complete knowledge of Lisp syntax, but since it does
  1639. not use the reader, and must work incrementally, it can be confused by legal
  1640. constructs.  Lisp mode totally ignores the read-table, so user-defined read
  1641. macros have no effect on the editor.  In some cases, the values the @hid[Lisp
  1642. Syntax] character attribute can be changed to get a similar effect.
  1643.  
  1644. Lisp commands consistently treat semicolon (@f[;]) style comments as
  1645. whitespace when parsing, so a Lisp command used in a comment will affect the
  1646. next (or previous) form outside of the comment.  Since @f[#| ... |#] comments
  1647. are not recognized, they can used to comment out code, while still allowing
  1648. Lisp editing commands to be used.
  1649.  
  1650. Strings are parsed similarly to symbols.  When within a string, the next form
  1651. is after the end of the string, and the previous form is the beginning of the
  1652. string.
  1653.  
  1654.  
  1655. @defhvar[var "Defun Parse Goal", val {2}]
  1656. @defhvar1[var "Maximum Lines Parsed", val {500}]
  1657. @defhvar1[var "Minimum Lines Parsed", val {50}]
  1658. In order to save time, Lisp mode does not parse the entire buffer every time
  1659. a Lisp command is used.  Instead, it uses a heuristic to guess the region of
  1660. the buffer that is likely to be interesting.  These variables control the
  1661. heuristic.
  1662.  
  1663. Normally, parsing begins and ends on defun boundaries (an open parenthesis at
  1664. the beginning of a line).  @hid[Defun Parse Goal] specifies the number of
  1665. defuns before and after the point to parse.  If this parses fewer lines than
  1666. @hid[Minimum Lines Parsed], then parsing continues until this lower limit is
  1667. reached.  If we cannot find enough defuns within @hid[Maximum Lines Parsed]
  1668. lines then we stop on the farthest defun found, or at the point where we
  1669. stopped if no defuns were found.
  1670.  
  1671. When the heuristic fails, and does not parse enough of the buffer, then
  1672. commands usually act as though a syntax error was detected.  If the parse
  1673. starts in a bad place (such as in the middle of a string), then Lisp commands
  1674. will be totally confused.  Such problems can usually be eliminated by
  1675. increasing the values of some of these variables.
  1676. @enddefhvar
  1677.  
  1678. @defhvar[var "Parse Start Function", val {start-of-parse-block}]
  1679. @defhvar1[var "Parse End Function", val {end-of-parse-block}]
  1680. These variables determine the region of the buffer parsed.  The values are
  1681. functions that take a mark and move it to the start or end of the parse region.
  1682. The default values implement the heuristic described above.
  1683. @enddefhvar
  1684.  
  1685.  
  1686.  
  1687. @comment[@chap(Interacting With Lisp)]
  1688. @include(lisp)
  1689.  
  1690.  
  1691. @comment[@chap(Mail Interface)]
  1692. @include(mail)
  1693.  
  1694.  
  1695. @comment[@chap(Netnews Interface)]
  1696. @include(netnews)
  1697.  
  1698.  
  1699.  
  1700. @chap[System Interface]
  1701.  
  1702. @hemlock provides a number of commands that access operating system resources
  1703. such as the filesystem and print servers.  These commands offer an alternative
  1704. to leaving the editor and using the normal operating system command language
  1705. (such as the Unix shell), but they are implementation dependent.  Therefore,
  1706. they might not even exist in some implementations.
  1707.  
  1708.  
  1709. @section[File Utility Commands]
  1710. This section describes some general file operation commands and quick directory
  1711. commands. 
  1712.  
  1713. See section @ref[dired] for a description @hemlock's directory editing
  1714. mechanism, @hid[Dired] mode.
  1715.  
  1716. @defcom[com "Copy File"]
  1717. This command copies a file, allowing one wildcard in the filename.  It prompts
  1718. for source and destination specifications.
  1719.  
  1720. If these are both directories, then the copying process is recursive on the
  1721. source, and if the destination is in the subdirectory structure of the source,
  1722. the recursion excludes this portion of the directory tree.  Use
  1723. @f[dir-spec-1/*] to copy only the files in a source directory without
  1724. recursively descending into subdirectories.
  1725.  
  1726. If the destination specification is a directory, and the source is a file, then
  1727. it is copied into the destination with the same filename.
  1728.  
  1729. The copying process copies files maintaining the source's write date.
  1730.  
  1731. See the description of @hid[Dired Copy File Confirm], page
  1732. @pageref[copy-confirm], for controlling user interaction when the destination
  1733. exists.
  1734. @enddefcom
  1735.  
  1736. @defcom[com "Rename File"]
  1737. This command renames a file, allowing one wildcard in the filename.  It prompts
  1738. for source and destination specifications.
  1739.  
  1740. If the destination is a directory, then the renaming process moves file(s)
  1741. indicated by the source into the directory with their original filenames.
  1742.  
  1743. For Unix-based implementations, if you want to rename a directory, do not
  1744. specify the trailing slash in the source specification.
  1745. @enddefcom
  1746.  
  1747. @defcom[com "Delete File"]
  1748. This command prompts for the name of a file and deletes it.
  1749. @enddefcom
  1750.  
  1751. @defcom[com "Directory", bind (C-x C-d)]
  1752. @defcom1[com "Verbose Directory", bind (C-x C-D)]
  1753. These commands prompt for a pathname (which may contain wildcards), and display
  1754. a directory listing in a pop-up window.  If a prefix argument is supplied, then
  1755. normally hidden files such as Unix dot-files will also be displayed.  
  1756. @hid[Directory] uses a compact, multiple-column format; 
  1757. @hid[Verbose Directory] displays one file on a line, with information about
  1758. protection, size, etc.
  1759. @enddefcom
  1760.  
  1761.  
  1762. @section[Printing]
  1763.  
  1764. @defcom[com "Print Region"]
  1765. @defcom1[com "Print Buffer"]
  1766. @defcom1[com "Print File"]
  1767. @hid[Print Region] and @hid[Print Buffer] print the contents of the current
  1768. region and the current buffer, respectively.  @hid[Print File] prompts for a
  1769. the name of a file and prints that file.  Any error messages will be displayed
  1770. in the echo area.
  1771. @enddefcom
  1772.  
  1773. @defhvar[var "Print Utility", val {"/usr/cs/bin/lpr"}]
  1774. @defhvar1[var "Print Utility Switches", val {()}]
  1775. @hid[Print Utility] is the program the print commands use to send files to the
  1776. printer.  The program should act like @f[lpr]: if a filename is given as an
  1777. argument, it should print that file, and if no name appears, standard input
  1778. should be assumed.  @hid[Print Utility Switches] is a list of strings
  1779. specifying the options to pass to the program.
  1780. @enddefhvar
  1781.  
  1782.  
  1783. @section[Scribe]
  1784. @defcom[com "Scribe Buffer File",
  1785.     stuff (bound to @bf[C-x c] in @hid[Scribe] mode)]
  1786. @defhvar1[var "Scribe Buffer File Confirm", val {t}]
  1787. @defcom1[com "Scribe File"]
  1788. @hid[Scribe Buffer File] invokes @hid[Scribe Utility] on the file associated
  1789. with the current buffer.  That process's default directory is the directory of
  1790. the file.  The process sends its output to the @hid[Scribe Warnings] buffer.
  1791. Before doing anything, this asks the user to confirm saving and formatting the
  1792. file.  This prompting can be inhibited with "Scribe Buffer File Confirm".
  1793.  
  1794. @hid[Scribe File] invokes @hid[Scribe Utility] on a file supplied by the user
  1795. in the same manner as describe above.
  1796. @enddefcom
  1797.  
  1798. @defhvar[var "Scribe Utility", val {"/usr/misc/bin/scribe"}]
  1799. @defhvar1[var "Scribe Utility Switches"]
  1800. @hid[Scribe Utility] is the program the Scribe commands use to compile the text
  1801. formatting.  @hid[Scribe Utility Switches] is a list of strings whose contents
  1802. would be contiguous characters, other than space, had the user invoked this
  1803. program on a command line outside of @hemlock.  Do not include the name of the
  1804. file to compile in this variable; the Scribe commands supply this.
  1805. @enddefhvar
  1806.  
  1807. @defcom[com "Select Scribe Warnings", bind (Scribe: C-M-C)]
  1808. This command makes the @hid[Scribe Warnings] buffer current if it exists.
  1809. @enddefcom
  1810.  
  1811.  
  1812. @section[Miscellaneous]
  1813.  
  1814. @defcom[com "Manual Page"]
  1815. This command displays a Unix manual page in a buffer which is in @hid[View]
  1816. mode.  When given an argument, this puts the manual page in a pop-up display.
  1817. @enddefcom
  1818.  
  1819. @defcom[com "Unix Filter Region"]
  1820. This command prompts for a UNIX program and then passes the current region to
  1821. the program as standard input.  The standard output from the program is used to
  1822. replace the region.  This command is undoable.
  1823. @enddefcom
  1824.  
  1825.  
  1826.  
  1827. @chap[Simple Customization]
  1828.  
  1829. @index[customization]@hemlock can be customized and extended to a very
  1830. large degree, but in order to do much of this a knowledge of Lisp is
  1831. required.  These advanced aspects of customization are discussed in the
  1832. @i[Hemlock Command Implementor's Manual], while simpler methods of
  1833. customization are discussed here.
  1834.  
  1835.  
  1836. @section[Keyboard Macros]
  1837. @index[keyboard macros]
  1838. Keyboard macros provide a facility to turn a sequence of commands into one
  1839. command.
  1840.  
  1841. @defcom[com "Define Keyboard Macro", bind {C-x (}]
  1842. @defcom1[com "End Keyboard Macro", bind {C-x )}]
  1843. @hid[Define Keyboard Macro] starts the definition of a keyboard macro.  The
  1844. commands which are invoked up until @hid[End Keyboard Macro] is invoked
  1845. become the definition for the keyboard macro, thus replaying the keyboard
  1846. macro is synonymous with invoking that sequence of commands.
  1847. @enddefcom
  1848.  
  1849. @defcom[com "Last Keyboard Macro", bind (C-x e)]
  1850. This command is the keyboard macro most recently defined; invoking it will
  1851. replay the keyboard macro.  The prefix argument is used as a repeat count.
  1852. @enddefcom
  1853.  
  1854. @defcom[com "Define Keyboard Macro Key", bind (C-x M-(; )]
  1855. @defhvar1[var "Define Keyboard Macro Key Confirm", val {t}]
  1856. This command prompts for a key before going into a mode for defining keyboard
  1857. macros.  After defining the macro @hemlock binds it to the key.  If the key is
  1858. already bound, @hemlock asks for confirmation before clobbering the binding;
  1859. this prompting can be inhibited by setting @hid[Define Keyboard Macro Key
  1860. Confirm] to @nil.
  1861. @enddefcom
  1862.  
  1863. @defcom[com "Keyboard Macro Query", bind (C-x q)]
  1864. This command conditionalizes the execution of a keyboard macro.  When invoked
  1865. during the definition of a macro, it does nothing.  When the macro replays, it
  1866. prompts the user for a key-event indicating what action to take.  The following
  1867. commands are defined:
  1868. @begin[description]
  1869. @binding[Escape]@\
  1870.  Exit all repetitions of this keyboard macro.  More than one may have been
  1871. specified using a prefix argument.
  1872.  
  1873. @binding[Space, y]@\
  1874.  Proceed with the execution of the keyboard macro.
  1875.  
  1876. @binding[Delete, Backspace, n]@\
  1877.  Skip the remainder of the keyboard macro and go on to the next repetition, if
  1878. any.
  1879.  
  1880. @binding[!]@\
  1881.  Do all remaining repetitions of the keyboard macro without prompting.
  1882.  
  1883. @binding[.]@\
  1884.  Complete this repetition of the macro and then exit without doing any of the
  1885. remaining repetitions.
  1886.  
  1887. @binding[C-r]@\
  1888.  Do a recursive edit and then prompt again.
  1889. @end[description]
  1890. @enddefcom
  1891.  
  1892. @defcom[com "Name Keyboard Macro"]
  1893. This command prompts for the name of a command and then makes the
  1894. definition for that command the same as @hid[Last Keyboard Macro]'s current
  1895. definition.  The command which results is not clobbered when another
  1896. keyboard macro is defined, so it is possible to keep several keyboard
  1897. macros around at once.  The resulting command may also be bound to a key
  1898. using @hid[Bind Key], in the same way any other command is.
  1899. @enddefcom
  1900.  
  1901. Many keyboard macros are not for customization, but rather for one-shot
  1902. use, a typical example being performing some operation on each line of a file.
  1903. To add "@f[del ]" to the beginning and "@f[.*]" to the end of every line in
  1904. in a buffer, one could do this:
  1905. @begin[programexample]
  1906. C-x ( d e l Space C-e . * C-n C-a C-x ) C-u 9 9 9 C-x e
  1907. @end[programexample]
  1908. First a keyboard macro is defined which performs the desired operation on
  1909. one line, and then the keyboard macro is invoked with a large prefix
  1910. argument.  The keyboard macro will not actually execute that many times;
  1911. when the end of the buffer is reached the @binding[C-n] will get an error
  1912. and abort the execution.
  1913.  
  1914.  
  1915. @section[Binding Keys]
  1916. @index[key bindings]
  1917. @label[binding-keys]
  1918.  
  1919. @defcom[com "Bind Key"]
  1920. This command prompts for a command, a key and a kind of binding to make,
  1921. and then makes the specified binding.  The following kinds of bindings are
  1922. allowed:
  1923. @begin[description]
  1924. @i[buffer]@\Prompts for a buffer and then makes a key binding which is
  1925. only present when that buffer is the current buffer.
  1926.  
  1927. @i[mode]@\Prompts for the name of a mode and then makes a key binding which
  1928. is only in present when that mode is active in the current buffer.
  1929.  
  1930. @i[global]@\Makes a global key binding which is in effect when there is
  1931. no applicable mode or buffer key binding.  This is the default.
  1932. @end[description]
  1933. @enddefcom
  1934.  
  1935. @defcom[com "Delete Key Binding"]
  1936. This command prompts for a key binding the same way that @hid[Bind Key]
  1937. does and makes the specified binding go away.
  1938. @enddefcom
  1939.  
  1940. @section[Hemlock Variables]
  1941.  
  1942. @label[vars]@index[variables, hemlock]@index[hemlock variables]A number
  1943. of commands use @hemlock variables as flags to control their behavior.  Often
  1944. you can get a command to do what you want by setting a variable.  Generally the
  1945. default value for a variable is chosen to be the safest value for novice users.
  1946.  
  1947. @defcom[com "Set Variable"]
  1948. This command prompts for the name of a @hemlock variable and an expression,
  1949. then sets the current value of the variable to the result of the evaluation of
  1950. the expression.
  1951. @enddefcom
  1952.  
  1953.  
  1954. @defcom[com "Defhvar"]
  1955. Like @hid[Set Variable], this command prompts for the name of a @hemlock
  1956. variable and an expression.  Like @hid[Bind Key], this command prompts for a
  1957. place: mode, buffer or local.  The result of evaluating the expression is
  1958. defined to be the value of the named variable in the specified place.
  1959.  
  1960. This command is most useful for making mode or buffer local bindings of
  1961. variables.  Redefining a variable in a mode or buffer will create a
  1962. customization that takes effect only when in that mode or buffer.
  1963.  
  1964. Unlike @hid[Set Variable], the variable name need not be the name of an
  1965. existing variable: new variables may be defined.  If the variable is already
  1966. defined in the current environment, @hemlock copies the documentation and hooks
  1967. to the new definition.
  1968. @enddefcom
  1969.  
  1970.  
  1971. @section[Init Files]
  1972. @index[init files]
  1973. @hemlock customizations are normally put in @hemlock's initialization file,
  1974. "@f[hemlock-init.lisp]", or when compiled "@f[hemlock-init.fasl]".  When
  1975. starting up Lisp, use the @f[-hinit] switch to indicate a particular file.  The
  1976. contents of the init file must be Lisp code, but there is a fairly
  1977. straightforward correspondence between the basic customization commands and the
  1978. equivalent Lisp code.  Rather than describe these functions in depth here, a
  1979. brief example follows:
  1980. @begin[programexample]
  1981. ;;; -*- Mode: Lisp; Package: Hemlock -*-
  1982.  
  1983. ;;; It is necessary to specify that the customizations go in
  1984. ;;; the hemlock package.
  1985. (in-package 'hemlock)
  1986.  
  1987. ;;; Bind @hid[Kill Previous Word] to @binding[M-h].
  1988. (bind-key "Kill Previous Word" '#(#\m-h))
  1989. ;;;
  1990. ;;; Bind @hid[Extract List] to @binding[C-M-?] when in @hid[Lisp] mode.
  1991. (bind-key "Extract List" '#(#\c-m-?) :mode "Lisp")
  1992.  
  1993. ;;; Make @binding[C-w] globally unbound.
  1994. (delete-key-binding '#(#\c-w))
  1995.  
  1996. ;;; Make string searches case-sensitive.
  1997. (setv string-search-ignore-case nil)
  1998. ;;;
  1999. ;;; Make "Query Replace" replace strings literally.
  2000. (setv case-replace nil)
  2001. @end[programexample]
  2002. For a detailed description of these functions, see the @i[Hemlock Command
  2003. Implementor's Manual].
  2004.